package com.gs.cd.eum;


import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

/**
 * @Author seven
 * @Date 2020/12/25 15:22
 * @Description 层级分类
 * system：系统级别
 * project：项目级别
 * tenant：租户级别
 * @Version 1.0
 */
public enum CategoryEnum {
    SYSTEM("system"),
    PROJECT("project"),
    TENANT("tenant");

    @EnumValue
    private final String name;

    CategoryEnum(String name) {
        this.name = name;
    }

    @JsonValue
    public String getName() {
        return name;
    }

    @JsonCreator
    public static CategoryEnum fromName(String name) {
        for (CategoryEnum value : CategoryEnum.values()) {
            if (value.getName().equals(name)) return value;
        }
        return CategoryEnum.TENANT;
    }
}